// alex lawrence

[re]solution documentation

Posted on 2009-01-21 in Web, [re]solution, PHP

This is the API documentation for [re]solution. The system ist quite small so the documentation fits on one page.

Global variables

Public

$http_vars
Merged array of $_GET and $_POST (not automatically escaped!)
$admin_path
Path to admin area with trailing slash

In admin area

$user
The logged in user (only if login was requested, otherwise null)
$user->login
Name of user
$user->password
Password (MD5 encrypted)
$user->language
Language of user
$user->superuser
Flag whether user is superuser
$success_message
A status success message that the system will automatically display if set
$error_message
A status error message that the system will automatically display if set

The node object

author
Author
class
Class name
date
Creation date
file
Array of file items
file->height
Height (if it is an image)
file->id
ID
file->idx
Index
file->nid
Referenced node id
file->mime
MIME type as string
file->width
Width (if it is an image)
file->url
Relative location seen from /admin folder
id
ID
idx
Index
references
Every reference node as associative array
title
Title
text
Array of file items
text->content
Text
text->teaser
Teaser text
text->id
ID
text->idx
Index
text->nid
referenced node id

The class object

name
Class name
references
Names of referenced classes as array
file
File count (0..9 / 10 == arbitrary)
text
Text count (0..9 / 10 == arbitrary)
tinyenabled
TinyMCE on/off
tinycss
Relative location of external CSS file seen from /admin folder
tinyswitch
Editor switch available
tinytags
Allowed HTML tags for TinyMCE
tinytteaser
Teaser Break on/off
admincreatedelete
Admin rights for creating and deleting nodes
adminmodify
Admin rights for modifying nodes
adminsort
Admin rights for sorting nodes
mimetypes
Allowed MIME types as comma seperated string (or empty if every MIME type is allowed)

Functions

function get_first_node( $class = "", $title = "" )
/**
* Selects the node with the highest index.
*
* @param class class of the node (optional)
* @param title title of the node (this is not safe, since the title is not unique)
* @return the selected node
*/

function get_node_by_id( $id )
/**
* Selects a node.
*
* @param id id of the node
* @return the selected node
*/

function get_nodes_count( $class = "", $filter = array() )
/**
* Selects node count of certain nodes.
*
* @param class if set, only nodes of this class are counted
* @param filter if set, only nodes within this filter are counted
* @return the count of selected nodes
*/

function get_nodes( $class = "", $count = 0, $filter = array() )
/**
* Selects multiple nodes.
*
* @param class if set, only nodes of this class are selected
* @param count count of selected nodes (0 for abritary)
* @param filter if set, only nodes within this filter are selected
* @return the selected nodes
*/

function update_or_insert_node( $data )
/**
* Updates or inserts a node.
*
* @param data arrray with data to be inserted
*/

function get_class_object( $class_name )
/**
* Selects a single class object.
*
* @param class_name the name of the class
* @return selected class object
*/

function get_class_objects()
/**
* Selects all class objects.
*
* @return selected class objects
*/

function get_user( $login )
/**
* Selects a single user.
*
* @param login the login of the user
* @return the selected user
*/

function get_users()
/**
* Selects all users.
*
* @return the selected users
*/

function move_object_up( $object, $type )
/**
* Moves an object up by changing its idx and the idx of the previous object
*
* @param object the object
* @param type the type (currently "file", "text" or "node")
*/

function move_object_down( $object, $type )
/**
* Moves an object down by changing its idx and the idx of the previous object
*
* @param object the object
* @param type the type (currently "file", "text" or "node")
*/

function get_file_by_id( $id )
/**
* Selects a file by its id
*
* @param id the file id
* @return the file
*/

function get_text_by_id( $id )
/**
* Selects a text by its id
*
* @param id the text id
* @return the text
*/

function create_output_for_file( $file )
/**
* Creates a standard output for a file item concering the mime type
*
* @param file the file item
* @return the output
*/

function perform_sql_query( $query )
/**
* Performs a mysql query. Use this method instead of mysql_query().
*
* @param query the query to execute
* @return the result handle
*/

function create_sql_insert_from_assoc( $target_table, $assoc, $exclude_id = false )
/**
* Creates a sql insert query from an assoc array.
*
* @target_table the target table
* @param assoc the input array
* @param exclude_id whether to exclude the id from the query or not
* @return the insert sql
*/

function escape_array( $array )
/**
* Escapes all contents of an array.
*
* @param array the array which should be escaped
*/

function get_http_vars()
/**
* Selects all HTTP variables ($_POST and $_GET) and escapes them.
*
* @return all HTTP variables
*/

function fix_array_image_buttons( $array )
/**
* Due to Internet Explorer 6 bug input type image is not working correctly.
* This fixes the bug.
*
* @param array the input array
* @return the new array
*/

function string_to_array( $string, $delimiter )
/**
* Transforms a string into an array
*
* @param string the input string
* @param delimiter the token delimiter
* @return the output array
*/

function array_to_string( $array, $delimiter )
/**
* Transforms an array into a string
*
* @param array the input array
* @param delimiter the token delimiter
* @return the output string
*/

function get_input( $name, $data = null )
/**
* Generates an input element for a given title and data
*
* @param name name of the element
* @param data node, text or file object
* @return the target input element
*/

function closetags( $html )
/**
* Closes all open xhtml tags at the end of the string
*
* @param html input string
* @return html string
*/